//
//  YBClassBasicInfoFooterView.m
//  ZhongWangYuanApp
//
//  Created by apple on 2019/4/26.
//  Copyright © 2019 apple. All rights reserved.
//

#import "YBClassBasicInfoFooterView.h"

@interface YBClassBasicInfoFooterView ()

@property (nonatomic , strong) UILabel * mustNumberLabel;

@property (nonatomic , strong) UILabel * chooseNumberLabel;

@property (nonatomic , strong) UILabel * mustTimeLabel;

@property (nonatomic , strong) UILabel * chooseTimeLabel;

@end

@implementation YBClassBasicInfoFooterView

- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithReuseIdentifier:reuseIdentifier];
    if (self) {
        self.contentView.backgroundColor = [UIColor whiteColor];
        [self initMyView];
    }
    return self;
}

-(void)initMyView
{
    [self.contentView addSubview:self.mustNumberLabel];
    [self.contentView addSubview:self.mustTimeLabel];
    [self.contentView addSubview:self.chooseNumberLabel];
    [self.contentView addSubview:self.chooseTimeLabel];
    
    self.mustNumberLabel.sd_layout
    .leftSpaceToView(self.contentView , 0)
    .topSpaceToView(self.contentView, 0)
    .heightIs(ItemHeight * 80)
    .widthIs([UIScreen zj_screenWith] / 2);
    
    self.mustTimeLabel.sd_layout
    .leftSpaceToView(self.mustNumberLabel , 0)
    .topSpaceToView(self.contentView, 0)
    .heightIs(ItemHeight * 80)
    .widthIs([UIScreen zj_screenWith] / 2);
    
    self.chooseNumberLabel.sd_layout
    .leftSpaceToView(self.contentView , 0)
    .topSpaceToView(self.mustNumberLabel, 0)
    .heightIs(ItemHeight * 80)
    .widthIs([UIScreen zj_screenWith] / 2);
    
    self.chooseTimeLabel.sd_layout
    .leftSpaceToView(self.chooseNumberLabel , 0)
    .topSpaceToView(self.mustNumberLabel, 0)
    .heightIs(ItemHeight * 80)
    .widthIs([UIScreen zj_screenWith] / 2);
    
    UIView * lineView1 = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
    lineView1.backgroundColor = [UIColor sepLineColor];
    [self.contentView addSubview:lineView1];
    lineView1.sd_layout
    .bottomSpaceToView(self.contentView, 0)
    .leftSpaceToView(self.contentView, 0)
    .rightSpaceToView(self.contentView, 0)
    .heightIs(normalBorderWidth);
    
    UIView * lineView2 = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
    lineView2.backgroundColor = [UIColor sepLineColor];
    [self.contentView addSubview:lineView2];
    lineView2.sd_layout
    .bottomSpaceToView(self.contentView, ItemHeight * 80)
    .leftSpaceToView(self.contentView, 0)
    .rightSpaceToView(self.contentView, 0)
    .heightIs(normalBorderWidth);
}

-(void)setInfoWithMustNumber:(NSString *)mustNumber mustTime:(NSString *)mustTime chooseNumber:(NSString *)chooseNumber chooseTime:(NSString *)chooseTime
{
    self.mustNumberLabel.text = [NSString stringWithFormat:@"必修课：%ld门" , [mustNumber integerValue]];
    
    self.mustTimeLabel.text = [NSString stringWithFormat:@"必修学时：%.1lf学时" , [mustTime floatValue]];
    
    self.chooseNumberLabel.text = [NSString stringWithFormat:@"选修课：%ld门" , [chooseNumber integerValue]];
    
    self.chooseTimeLabel.text = [NSString stringWithFormat:@"选修学时：%.1lf学时" , [chooseTime floatValue]];
}


-(UILabel *)mustNumberLabel
{
    if (!_mustNumberLabel) {
        _mustNumberLabel = [ToolClass creatLabelWithFrame:CGRectMake(0, 0, 1, 1) font:16 textColor:[UIColor textGrayColor] text:@"必修课：0门"];
        _mustNumberLabel.textAlignment = NSTextAlignmentCenter;
    }
    return _mustNumberLabel;
}

-(UILabel *)mustTimeLabel
{
    if (!_mustTimeLabel) {
        _mustTimeLabel = [ToolClass creatLabelWithFrame:CGRectMake(0, 0, 1, 1) font:16 textColor:[UIColor textGrayColor] text:@"必修学时：0学时"];
        _mustTimeLabel.textAlignment = NSTextAlignmentCenter;
    }
    return _mustTimeLabel;
}

-(UILabel *)chooseNumberLabel
{
    if (!_chooseNumberLabel) {
        _chooseNumberLabel = [ToolClass creatLabelWithFrame:CGRectMake(0, 0, 1, 1) font:16 textColor:[UIColor textGrayColor] text:@"选修课：0门"];
        _chooseNumberLabel.textAlignment = NSTextAlignmentCenter;
    }
    return _chooseNumberLabel;
}

-(UILabel *)chooseTimeLabel
{
    if (!_chooseTimeLabel) {
        _chooseTimeLabel = [ToolClass creatLabelWithFrame:CGRectMake(0, 0, 1, 1) font:16 textColor:[UIColor textGrayColor] text:@"选修学时：0学时"];
        _chooseTimeLabel.textAlignment = NSTextAlignmentCenter;
    }
    return _chooseTimeLabel;
}

@end
